from rest_framework.serializers import ModelSerializer

from home.models import Nav, Banner, Category


class NavSer(ModelSerializer):
    class Meta:
        model = Nav
        fields = '__all__'


class BannerSer(ModelSerializer):
    class Meta:
        model = Banner
        fields = '__all__'


class CategorySerS(ModelSerializer):
    class Meta:
        model = Category
        fields = ['id', 'name']


class CategorySer(ModelSerializer):
    children = CategorySerS(many=True)
    class Meta:
        model = Category
        fields = '__all__'
